#include <iostream>
using namespace std;

int main()
{
	int day, p1 = 0, p2 = 0, p3 = 0, a = 0, b = 0, c = 0;
	cin >> day;
	for(int i = 0; i < day; i++)
	{
		cin >> p1 >> p2 >> p3;
		a += p1;
		b += p2;
		c += p3;
	}
	cout << a << " " << b << " " << c << " " << a + b + c << endl;
	return 0;
}
